﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Maintainance/Maintainance.master" AutoEventWireup="true" CodeBehind="Photos.aspx.cs" Inherits="OpenPhotoAlbum.Maintainance.Photos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ph1" runat="server">
	<asp:UpdatePanel ID="up1" runat="server" RenderMode="Inline">
		<ContentTemplate>
		
		
	<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="15" PagerSettings-Position="TopAndBottom"
		AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="PhotoId" 
		DataSourceID="LinqDataSource1">
		<PagerSettings Position="TopAndBottom" />
		<HeaderStyle Font-Size="0.9em" />
		<RowStyle Font-Size="0.9em" />
		<Columns>
			<asp:TemplateField HeaderText="User" SortExpression="Album.User.UserName">
				<ItemTemplate>
					<asp:HyperLink ID="hlUser" runat="server" Target="_blank" />
				</ItemTemplate>
				<ItemStyle Width="90"/>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Album">
				<ItemTemplate>
					<asp:HyperLink ID="hlAlbum" runat="server" Target="_blank" />
				</ItemTemplate>
				<ItemStyle Width="100" />
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Creation Date" SortExpression="PhotoCreationDate">
				<ItemTemplate>
					<div style="white-space:normal; word-break:break-all; width:200px;">
						<b><%# HttpUtility.HtmlEncode((string)Eval("PhotoTitle")) %></b>
						<span style="color:Red"><%# this.AlbumCoverToString((bool)(Eval("IsAlbumCover"))) %></span><br />
						<%# HttpUtility.HtmlEncode((string)Eval("PhotoDescription")) %><br />
						<%# HttpUtility.HtmlEncode(Eval("PhotoCreationDate").ToString())%>
					</div>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Thumbnail">
				<ItemTemplate>
					<asp:HyperLink ID="hlPhoto" runat="server" Target="_blank">
						<asp:Image ID="imgPhoto" runat="server" BorderStyle="None" Width="70px" />
					</asp:HyperLink>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="IsBanned" SortExpression="IsBanned">
				<ItemTemplate>
					<%# this.BoolToSymbol((bool)(Eval("IsBanned")))%>
				</ItemTemplate>
				<ItemStyle HorizontalAlign="Right" Width="75" />
			</asp:TemplateField>
			<asp:ButtonField HeaderText="Change" Text="*" CommandName="BanUnban" ButtonType="Button" />
			<asp:TemplateField HeaderText="IsPromoted" SortExpression="IsPromoted">
				<ItemTemplate>
					<%# this.BoolToSymbol((bool)(Eval("IsPromoted")))%>
				</ItemTemplate>
				<ItemStyle HorizontalAlign="Right" Width="75" />
			</asp:TemplateField>
			<asp:ButtonField HeaderText="Change" Text="*" CommandName="PromoteDemote" ButtonType="Button" />
			<asp:ButtonField HeaderText="Delete" Text="Delete" CommandName="DeletePhoto" ButtonType="Button" />
		</Columns>
	</asp:GridView>
	<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
		ContextTypeName="OpenPhotoAlbum.DbAccess.DbLinqClassesDataContext" 
		OrderBy="PhotoCreationDate desc" TableName="Photos">
	</asp:LinqDataSource>
	
	</ContentTemplate>
	</asp:UpdatePanel>
</asp:Content>
